<template>
  <el-card class="box-card">
    <div class="taobao-loop-list" v-loading="loading">
      <!-- 轮播图 -->
      <div>
        <el-carousel height="210px">
          <el-carousel-item v-for="item in loop" :key="item.id">
            <a :href="item.targetUrl">
              <img :src="item.imageUrl+'_320x320xzq90.jpg_.webp'" alt="" style="object-fit: cover">
            </a>
          </el-carousel-item>
        </el-carousel>
      </div>
    </div>
  </el-card>
</template>
<script>
  import {getLoop} from '@/api/api'

  export default {
    data() {
      return {
        loop: [],
        loading: false
      }
    },
    created() {
      this.getLoop()
    },
    methods: {
      getLoop() {
        this.loading = true
        getLoop().then(response => {
          if (response.code === 20000) {
            this.loop = response.data
          }
          this.loading = false
        })
      }
    }
  }
</script>
<style scoped>

  .el-card__body{
       padding: 10px;
     }
  .taobao-loop-list img {
    width: 100%;
    height: 210px;
    border-radius: 4px;
  }

  .taobao-loop-list .el-carousel__button {
    height: 5px;
    width: 5px;
    border-radius: 50%;
  }
</style>
